home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 22 / Cream of the Crop 22.iso / doom / quake3.zip / IDGLOBE.ZIP / FLARE.QC < prev    next >
Text File  |  1996-08-25  |  3KB  |  92 lines

  1. /*======================================================================
  2. Launch_flare - Stan Smith (mailto:StoshSmith@worldnet.att.net) 25 Aug 96
  3.  
  4.     This routine just shoots a flare straight ahead; it'll burn bright
  5. for 15 game seconds, then dim for 5 more and fizz out.
  6.     Only one thing I don't like about it; if you shoot a flare into a
  7. door, then open the door, the flare is left hanging in space.  Not sure
  8. how to make it move with the door; not even sure it's possible!  Any
  9. suggestions?
  10.  
  11. ---DIRECTIONS FOR INSTALLATION:-----------------------------------------
  12. **** Add the following line to the W_Precache function in weapons.qc:
  13.     precache_model ("progs/laser.mdl"); // Enforcer laser for flare
  14. **** Add the following 2 lines to Impulse_Commands in weapons.qc:
  15.     if(self.impulse==20)
  16.         W_FireFlare();
  17.     (note: change the impulse #20 to something else if you're already
  18.      using it in another mod!)
  19. **** Modify config.cfg to bind the key you want to launch a flare, ex:
  20. bind f "impulse 20"
  21. **** Modify progs.src to add (immediately before the weapons.qc line) a
  22.     line which reads:
  23. flare.qc
  24.  
  25. Then compile everything and you're ready to go!!!!!
  26. (this function is a rework of both Id's missle launch code and
  27.     a Flare routine by Wedge, a.k.a. Steve Bond- wedge@nuc.net)
  28. ======================================================================*/
  29. void() flare_off={
  30.     sound(self,CHAN_WEAPON,"misc/power.wav",1,ATTN_NORM);
  31.     self.effects=EF_BRIGHTLIGHT;
  32.     self.nextthink=time+0.3;
  33.     self.think=SUB_Remove;
  34.     particle(self.origin+'0 0 1','0 0 150',111,150);
  35.     particle(self.origin+'0 0 1','0 0 120',73,200);};
  36.  
  37. void() flare_dim={
  38.     self.effects=EF_DIMLIGHT;
  39.     self.nextthink=time+5;
  40.     self.think=flare_off;};
  41.  
  42. void() flare_bright={
  43.     self.effects=EF_BRIGHTLIGHT;
  44.     self.nextthink=time+15;
  45.     self.think=flare_dim;
  46.     sound(self,CHAN_WEAPON,"misc/power.wav",1,ATTN_NORM);
  47.     particle(self.origin+'0 0 1','0 0 150',111,150);
  48.     particle(self.origin+'0 0 1','0 0 120',73,200);};
  49.  
  50. void() flare_touch={
  51.     if(other==self.owner) return;
  52.     if(pointcontents(self.origin)==CONTENT_SKY){
  53.         remove(self);
  54.         return;}
  55.     if(other.solid==SOLID_TRIGGER) return;
  56.     if(other.takedamage){
  57.         T_Damage(other,self,self.owner,1);
  58.         if(self.velocity!='0 0 0') remove(self);}
  59.     else{
  60.         WriteByte(MSG_BROADCAST,SVC_TEMPENTITY);
  61.         WriteByte(MSG_BROADCAST,TE_SPIKE);
  62.         WriteCoord(MSG_BROADCAST,self.origin_x);
  63.         WriteCoord(MSG_BROADCAST,self.origin_y);
  64.         WriteCoord(MSG_BROADCAST,self.origin_z);}
  65.     self.movetype=MOVETYPE_NONE;
  66.     self.velocity='0 0 0';
  67.     self.touch=SUB_Null;};
  68.  
  69. void() W_FireFlare={
  70.     local entity flare;
  71.     makevectors(self.v_angle);
  72.     self.attack_finished=time+2;
  73.     flare=spawn();
  74.     flare.owner=self;
  75.     flare.movetype=MOVETYPE_FLYMISSILE;
  76.     flare.solid=SOLID_BBOX;
  77.     flare.touch=flare_touch;
  78.     flare.classname="Flare";
  79.     flare.think=flare_bright;
  80.     flare.nextthink=time+2;
  81.     setmodel(flare,"progs/laser.mdl");
  82.     flare.effects=EF_DIMLIGHT;
  83.     makevectors(self.v_angle);
  84.     flare.velocity=aim(self,1000);
  85.     flare.velocity=flare.velocity*1000;
  86.     flare.angles=vectoangles(flare.velocity);
  87.     setsize(flare,'0 0 0','0 0 0');            
  88.     setorigin(flare,self.origin+v_forward*8);
  89.     self.punchangle_x=-1;
  90.     sound(self,CHAN_WEAPON,"weapons/grenade.wav",1,ATTN_NORM);
  91.     sprint(self,"Flare lanched\n");};
  92.